<script>
$(function() {
	$( ".new_book_btn" ).button({
        icons: {
            primary: "ui-icon-plus"
        },
        text: true
    });
    
	$( ".delete_book_btn" ).button({
        icons: {
            primary: "ui-icon-trash"
        },
        text: false
    });
    
	$( ".hightlight_btn" ).button({
        icons: {
            primary: "ui-icon-star"
        },
        text: false
    });
    
});
</script>

<form action="<?= URL::site("admin/newBook"); ?>" method="GET" >
	<button class="new_book_btn" style="font-size:12px;">Nuevo libro</button>	
</form>

<table cellspacing="0" class="classic_table">
	<thead>
		<tr>
			<th>Título</th>
			<th>Autor</th>
			<th>ISBN</th>
			<th>Brain Score</th>
			<th># Visitas</th>
			<th></th>
		<tr>
	</thead>
	<tbody>
		<?
		foreach($books as $book) {
		?>
		<tr>
		<td class="text_centered"><?= $book->title ?></td>
		<td class="text_centered">(Autor)</td>
		<td class="text_centered"><?= $book->isbn ?></td>
		<td class="text_centered"><?= $book->brain_score ?></td>
		<td class="text_centered">(Visitas)</td>
		<td>
			<div class="left">
				<form action="<?= URL::site("admin/highlightBook"); ?>">
					<input type="hidden" name="book" value="<?= $book->id ?>" />
					<button class="hightlight_btn">Destacar libro</button>
				</form>
			</div>
			<div class="left">
				<form action="admin/deleteBook">
					<input type="hidden" name="book" value="<?= $book->id ?>" />
					<button class="delete_book_btn">Eliminar libro</button>
				</form>
			</div>
		</td>
		</tr>
		<?	
		}
		?>
	</tbody>
</table>
